<?php
function zhizhi_setup() {
  load_theme_textdomain( 'zhizhi' );
  add_theme_support( 'title-tag' );
  add_theme_support( 'post-thumbnails' );
  // add_theme_support( 'automatic-feed-links' );
  add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption' ) );
  add_theme_support( 'customize-selective-refresh-widgets' );

  register_nav_menus( array(
    'main'    => '顶部主导航',
    // 'footer' => '页脚导航',
    // 'main-menu' => '左侧菜单',
  ) );

  // add_theme_support( 'post-formats', array(
  //  'aside',
  //  'image',
  //  'video',
  //  'quote',
  //  'link',
  //  'gallery',
  //  'audio',
  // ) );

  add_editor_style( array( 'assets/css/editor.css' ) );
}
add_action( 'after_setup_theme', 'zhizhi_setup' );

function fangtang_widgets_init() {
  register_sidebar( array(
    'name'          => '默认侧边栏',
    'id'            => 'sidebar',
    'description'   => '放置在这里的小工具会显示在默认侧边栏里。',
    'before_widget' => '<section id="%1$s" class="widget %2$s">',
    'after_widget'  => '</section>',
    'before_title'  => '<h3 class="widget-title">',
    'after_title'   => '</h3>',
  ) );
}
add_action( 'widgets_init', 'fangtang_widgets_init' );

function ft_tiny_mce_before_init( $mce_init ) {
  $mce_init['cache_suffix'] = 'v=180329';
  return $mce_init;
}
add_filter( 'tiny_mce_before_init', 'ft_tiny_mce_before_init' );


function zhizhi_excerpt_more( $link ) {
  if ( is_admin() ) {
    return $link;
  }

  $link = sprintf( '<a href="%1$s" class="more-link">继续阅读</a>',
    esc_url( get_permalink( get_the_ID() ) )
  );
  return $link;
}
add_filter( 'excerpt_more', 'zhizhi_excerpt_more' );

require get_parent_theme_file_path( '/inc/template-tags.php' );
require get_parent_theme_file_path( '/inc/reset-wp.php' );
require get_parent_theme_file_path( '/inc/breadcrumb.php' );
